package greatest;

import java.util.Scanner;

public class Gcd {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a, b;
		System.out.print("请输入两个正整数：");
		a = in.nextInt();
		b = in.nextInt();

		int c = 0;
		int d = 0;
		if (a > b) {
			c = a;
			d = b;
		} else {
			c = b;
			d = a;
		}

		int rest = 0;
		do {
			rest = c % d;
			c = d;
			d = rest;
		} while (rest != 0);

		System.out.println(a + "和" + b + "的最大公约数为：" + c);
		System.out.println(a + "和" + b + "的最小公倍数为：" + a * b / c);
		in.close();
	}
}
